Component({
    /**
     * 页面的初始数据
     */
    data: {
        showTips: false, //是否展示
    },
    properties: {
        content: {
            type: String,
            value: '添加到我的小程序，下次使用更便捷!'
        }
    },
    ready() {
        const _that = this;
        //获取本地缓存
        let cache = wx.getStorageSync('isFirst');
        if (cache) {
            _that.setData({
                showTips: false
            })
        } else {
            _that.setData({
                showTips: true
            })
            wx.setStorageSync('isFirst', '0');
            setTimeout(() => {
                _that.setData({
                    showTips: false
                })
            }, 5000); // 5s后消失
        }
    },
    methods: {
        //手动关闭
        closeTips() {
            const _that = this;
            _that.setData({
                showTips: false
            })
            wx.setStorageSync('isFirst', '0');
        }
    }
})
